﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ControlExportationHistory.ascx.cs" Inherits="xManagerWebApp.ControlExportationHistory" %>

<asp:DropDownList ID="ddl_ExportationType" runat="server" AutoPostBack="True">
</asp:DropDownList>

<asp:GridView ID="GridView1" runat="server" EmptyDataText="Empty" AutoGenerateColumns="False" 
    DataSourceID="LinqDataSource1" AllowPaging="True" >
    <Columns>
        <%--<asp:TemplateField>
            <ItemTemplate>
                <asp:Button ID="bt_download" runat="server" Text="Download" onclick="bt_Download_Click" />
            </ItemTemplate>
        </asp:TemplateField>--%>
        <asp:BoundField DataField="Name" HeaderText="Name" ReadOnly="True" 
            SortExpression="Name" />
        <asp:BoundField DataField="CreationDate" HeaderText="CreationDate" ReadOnly="True" 
            SortExpression="CreationDate" />  
        <asp:BoundField DataField="UserEmail" HeaderText="UserEmail" ReadOnly="True" 
            SortExpression="UserEmail" />
        <asp:TemplateField HeaderText="Download">
            <ItemTemplate>
                <a href='/GetExportation.ashx?id=<%#Eval("ReportId") %>&type=<%#Eval("Type") %>'>
                    Download
                </a>
            </ItemTemplate>
        </asp:TemplateField>
    </Columns>
</asp:GridView>
<asp:LinqDataSource ID="LinqDataSource1" runat="server" 
    ContextTypeName="Core.DataAccessDataContext" 
    Select="new (Name, CreationDate, UserEmail, ReportId, Type)" 
    TableName="ExportatedReportsViews" OrderBy="CreationDate" 
    Where="Path != @Path &amp;&amp; Type == @Type">
    <WhereParameters>
        <asp:Parameter Name="Path" Type="String" />
        <asp:ControlParameter ControlID="ddl_ExportationType" Name="Type" 
            PropertyName="SelectedValue" Type="String" />
    </WhereParameters>
</asp:LinqDataSource>


